#!/usr/bin/perl -w
use 5.010;
use strict;
use warnings;
use Storable;

use Net::SNMP;

my $ii = 0;
$ii +=1;
print $ii;

my $OID_sysUpTime = "1.3.6.1.2.1.1.3.0";
my ($session,$error) = Net::SNMP->session(
  -hostname => shift || '192.168.10.163',
  -community => shift || 'public',
);

if (!defined $session) {
    printf("ERROR:%s\n",$error);
    exit 1;
}


my $result = $session->get_request(
  -varbindlist => [$OID_sysUpTime],  
);

if (!defined $result) {
    printf("ERROR:%s.\n",$session->error());
    $session->close();
    exit 1;
}

printf("The SysUpTime for host '%s' is %s.\n",$session->hostname(),$result->{$OID_sysUpTime});

$session->close();

exit 0;

